//
// Created by LONG on 2020/10/12.
//

#include <stdio.h>
#include "../../../lib/doctest.h"
#include "../../../../src/ccore/sctp/include/sctpApi.h"

TEST_SUITE ("SCTP_TS")
{
    TEST_CASE ("SCTP_TC")
    {
        int32_t rc;
        int sockc;
        int socks;
        SUBCASE("SCTP_SC_BASE")
        {
            rc = SCTPS_Init(&socks);
            REQUIRE(O5G_RC_OK == rc);
            rc = SCTPS_Bind(socks, "127.0.0.1", NGAP_SCTP_PORT);
            REQUIRE(O5G_RC_OK == rc);
            rc = SCTPS_Listen(socks);
            REQUIRE(O5G_RC_OK == rc);
            rc = SCTPC_Init(&sockc);
            REQUIRE(O5G_RC_OK == rc);
            rc = SCTPC_Connect(sockc, "127.0.0.1", NGAP_SCTP_PORT);
            REQUIRE(O5G_RC_OK == rc);

            rc = SCTPC_Final(sockc);
            REQUIRE(O5G_RC_OK == rc);
            rc = SCTPS_Final(socks);
            REQUIRE(O5G_RC_OK == rc);
        }
    }
}
